import pinia from './store'
import router from './router'
import { useUserStore } from './store/modules/user'
const userStore = useUserStore(pinia)
//全局导航守卫
router.beforeEach((to, from) => {
    //非登录页面token 不存在
    if (!userStore.token && to.path !== '/login') {
      return '/login'
    } else if (userStore.token && to.path === '/login') {
      return '/'
    }else {
      return true
    }
  
  
  })